#pragma once
#include"Pawns.h"
//Class Definition//
class CPlayer
{
private:
	//Class Variables----------------------------------------------//
	//an array of our 4 pawns
	CPawns m_Pawns[NumberOfPawns];
	//filler for hand obj
	//CHand 

	//tells us how many pawns at start
	int m_numAtStart;
	//tells us how many pawns at home
	int m_numAtHome;
	//This Player's Start Tile//
	int m_StartTileNumber;

public:
	//Class Functions----------------------------------------------//
	CPlayer()
	{
		 m_numAtStart = 4;
		 m_numAtHome = 0;
	}

	//if we need to update all pawns for something
	//Other Class Functions----------------------------------------------//
	void updatePawns()
	{
		for(int i = 0; i < NumberOfPawns; i++)
		{
			m_Pawns[i].update();
		}
	}
	//there are lots of ways we might move pawns but here is a simple one
	void movePawn(int num,float x, float y, float z)
	{		
		m_Pawns[num].setPos(x,y,z);
	}
	//to see what number or id tile has that a pawn may be on
	int checkTileNum(int num)
	{
		return m_Pawns[num].getTileNum();
	}
	//at some point we may need somethig like this
	void checkHand()
	{
		//some code that will check something soon
		int i = rand();
	}
	CPawns& getPawns(int pawnNumber)
	{
		return m_Pawns[pawnNumber];
	}
	void  setPawns(int n,CPawns p)
	{
		m_Pawns[n].setPos(p.getPosX(),p.getPosY(),p.getPosZ());
		m_Pawns[n].setRotateY(p.getRotateY());
	}


	//set and get for num of pawns at start
	void setNumAtStart(int  num)
	{
		m_numAtStart = num;
	}

	int getNumAtStart()
	{
		int Counter = 0;
		for(int Index = 0; Index < NumberOfPawns; Index++)
		{
			if(m_Pawns[Index].getState() == START)
			{
				Counter++;
			}
		}
		m_numAtStart = Counter;
		return Counter;
	}

	//set and get for num of pawns at homw
	void setNumAtHome(int  num)
	{
		m_numAtHome = num;
	}

	int getNumAtHome()
	{
		int Counter = 0;
		for(int Index = 0; Index < NumberOfPawns; Index++)
		{
			if(m_Pawns[Index].getState() == HOME)
			{
				Counter++;
			}
		}
		m_numAtHome = Counter;
		return Counter;
	}

	void SetStartTileNumber(int TileNumber)
	{
		m_StartTileNumber = TileNumber;
	}

	int getStartTileNumber(void)
	{
		return m_StartTileNumber;
	}
};